<?php

namespace app\api\controller;

use app\api\model\wanlshop\Category;
use app\common\controller\Api;
use think\Db;
use addons\cms\model\Block;


/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $this->success('请求成功');
    }

    //轮播图列表
    public function banner()
    {
        $block_model = new Block();
        $list = $block_model
            ->where('type','=','image')
            ->where('status','=','normal')
            ->where('name','=','banner')
            ->field('id,type,name,title,image')
            ->order('weigh','desc')
            ->select();

        $this->success('ok',$list);
    }

    //项目列表
    public function project()
    {
        $list = Category::where(['pid'=>0,'type'=>'goods'])
            ->field('id,name,image')
            ->select();

        $this->success('ok',$list);
    }


}
